Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

176
Vistas
I get "No matching signature" error in my background.js

I get the error "Uncaught TypeError: Error in invocation of scripting.executeScript(scripting.ScriptInjection injection, optional function callback): No matching signature." in my console. I have no idea what's wrong, someone please help me, I really appreciate it.

Here is the background.js code:

var Tabclicked = false;
disableBrowserAction();


function disableBrowserAction(tabId) {
    chrome.scripting.executeScript(tabId, { file: 'jquery.js' }, function() {
        chrome.scripting.executeScript(tabId, { file: 'CloseRuler.js' });
    });
}

function enableBrowserAction(tabId) {
    chrome.scripting.executeScript(tabId, { file: 'jquery.js' }, function() {
        chrome.scripting.executeScript(tabId, { files: 'Ruler.js' });
    });
}

function updateState() {
    if (Tabclicked == false) {
        Tabclicked = true;
        enableBrowserAction();
    } else {
        Tabclicked = false;
        disableBrowserAction();
    }
}

//chrome.pageAction.onClicked.addListener(updateState);

chrome.action.onClicked.addListener(function(tabId) {
    updateState(tabId);
    alert('File test alert');

});

alert('File test alert');

Here is my manifest:

{
    "name": "Physics Ruler",
    "description": "Position the ruler and measure the objects!",
    "version": "1.0",
    "manifest_version": 3,
    "permissions": [
        "activeTab",
        "scripting"
    ],
    "background": {
        "service_worker": "background.js",
        "type": "module"
    },
    "action": {
        "default_icon": "icon.png",
        "default_title": "Ruler",
        "name": "Physics Ruler"
    },
    "content_scripts": [{
        "js": ["jquery.js"],
        "matches": ["*://*/*"]
    }],
    "host_permissions": [
        "*://*/*"
    ]
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

So, I have found the answer, and the documentation was kind of not help full, I have just tried different things until it worked.

We have to make this function with chrome tabs:

chrome.tabs.query({ currentWindow: true, active: true }, function(tabs) {

in that function then we can use "tabs[0].id" to get the id.

for example:

function enableBrowserAction(tabId) {
chrome.tabs.query({ currentWindow: true, active: true }, function(tabs) {
    chrome.scripting.executeScript({ target: { tabId: tabs[0].id }, files: ['jquery.js'] }, function() {
        chrome.scripting.executeScript({ target: { tabId: tabs[0].id }, files: ['Ruler.js'] });
    });
});

}

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda